package com.play.airfight.enemy.enemy_contract;

import com.play.airfight.GlobalInfo;
import com.play.airfight.utils.UiUtils;

// 创建敌人的数据模板
public class EnemyTypeData {
    public int currentX = GlobalInfo.screenW / 2;  // 出生时的 X 在屏幕中间
    public int currentY = 0; // 出生时的 Y
    public int hp = 1; // 默认的血量
    public int speed = 5; // 默认移动速度
    public int customShape = 0; // 可以更改的敌人外观
    public int width = 0;
    public int height = 0;

    public EnemyTypeData(int layoutPosition) {
        // 将屏幕横向分成9分 ， 根据position 计算出现的水平位置
        int widthUnit = GlobalInfo.screenW / 9;
        currentX = widthUnit * layoutPosition + widthUnit / 2;

    }

    public EnemyTypeData() {

    }

    public void setEnemyType(EnemyType enemyType) {
        // 根据敌人属性设置尺寸
        switch (enemyType) {
            case soldier_level_one:
                width = UiUtils.dip2Pixel(GlobalInfo.level_1_solider_width);
                height = UiUtils.dip2Pixel(GlobalInfo.level_1_solider_height);
                speed = GlobalInfo.level_1_solider_speed;
                hp = GlobalInfo.level_1_solider_hp;
                break;
            case boss_level_one:
                width = UiUtils.dip2Pixel(GlobalInfo.level_1_boss_width);
                height = UiUtils.dip2Pixel(GlobalInfo.level_1_boss_height);
                speed = GlobalInfo.level_1_boss_speed;
                hp = GlobalInfo.level_1_boss_hp;
                break;

        }
        currentY -= height;
    }


}
